package com.ihrm.domain.system;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;


/**
 * 用户实体类
 */
@Entity
@Table(name = "bs_user")
@Getter
@Setter
public class User implements Serializable {
    private static final long serialVersionUID = 4297464181093070302L;

    @Id
    private String id;
    private String mobile;

    private String username;

    private String password;

    //启用状态 0为禁用 1为启用

    private Integer enableState;

    private Date createTime;

    private String companyId;

    private String companyName;

    private String departmentId;

    // 入职时间

    private Date timeOfEntry;

    // 聘用形式

    private Integer formOfEmployment;

    //工号

    private String workNumber;

    // 管理形式

    private String formOfManagement;

    private String workingCity;

   //转正时间

    private Date correctionTime;

   //在职状态 1.在职  2.离职

    private Integer inServiceStatus;

    private String departmentName;
    @ManyToMany
    @JsonIgnore
    @JoinTable(name="pe_user_role",joinColumns=
            {@JoinColumn(name="user_id",referencedColumnName="id")},
            inverseJoinColumns={@JoinColumn(name="role_id",referencedColumnName="id")}
    )
    private Set<Role> roles = new HashSet<Role>();//用户与角色   多对多

}
